﻿using System;
using K9Workflow;
using K9Workflow.Forms;
using K9Workflow.Forms.MySQL.Internal;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class MySQLFormDataStartupExtensions
    {
        public static K9WorkflowBuilder AddMySQLFormDataStore(this K9WorkflowBuilder builder, string connectionString)
        {
            builder.Services.AddScoped<DbConnectionFactory>(_ => new DbConnectionFactory(connectionString))
                .AddScoped<IFormDataStore, FormDataStore>();

            return builder;
        }
    }
}
